import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';
import 'package:flutter_douban/main_page/store/view/stroe_seckill_item_cell.dart';
import 'package:flutter_douban/model/store_category_model.dart';

class StroeSeckillView extends StatefulWidget {
  final List<StoreCategoryModel> list;

  const StroeSeckillView({Key? key, required this.list}) : super(key: key);

  @override
  _StroeSeckillViewState createState() => _StroeSeckillViewState();
}

class _StroeSeckillViewState extends State<StroeSeckillView> {
  @override
  Widget build(BuildContext context) {
    return Container(
      color: AppColors.page,
      width: MediaQuery.of(context).size.width,
      height: 230,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(left: 20),
            child: Text("每日秒杀",
                style: TextStyle(
                    fontSize: 20,
                    color: Colors.black,
                    fontWeight: FontWeight.bold)),
          ),
          Container(
            margin: EdgeInsets.only(top:12),
            width: MediaQuery.of(context).size.width,
            height: 180,
            child: ListView.builder(
                shrinkWrap: true,
                scrollDirection: Axis.horizontal,
                ///禁用滑动事件
                physics: AlwaysScrollableScrollPhysics(),
                itemCount: widget.list.length,
                itemBuilder: (BuildContext context, int index) {
                  return StroeSeckillItemCell(model: widget.list[index],index: index,list: widget.list,);
                }),
          )
        ],
      ),
    );
  }
}
